package com.dotstone.chipism.bean;

import com.dotstone.chipism.util.Util;

public class Order {
	private String id;
	private String publishUserId;
	private String publishUserName;
	private String publishUserPhone;
	private int createTime;
	private long installerTime;//时间戳
	private String installTime;
	private String explain;
	private int status;	//1 已完成 2 已受理 8未受理 9 已撤销
	private double score;
	private String region;
	private String address;
	private boolean needToScore = false;
	private String shopOrderNumber;
	public Order () {
	}
	
	public boolean isNeedToScore() {
		return needToScore;
	}
//	public void setNeedToScore(boolean needToScore) {
//		this.needToScore = needToScore;
//	}
	
	public String getId() {
		return id;
	}
	
	public String getShopOrderNumber() {
		return shopOrderNumber;
	}

	public void setShopOrderNumber(String shopOrderNumber) {
		this.shopOrderNumber = shopOrderNumber;
	}

	public void setId(String id) {
		this.id = id;
	}
	public String getPublishUserId() {
		return publishUserId;
	}
	public void setPublishUserId(String publishUserId) {
		this.publishUserId = publishUserId;
	}
	public String getPublishUserName() {
		return publishUserName;
	}
	public void setPublishUserName(String publishUserName) {
		this.publishUserName = publishUserName;
	}
	public String getPublishUserPhone() {
		return publishUserPhone;
	}
	public void setPublishUserPhone(String publishUserPhone) {
		this.publishUserPhone = publishUserPhone;
	}
	public int getCreateTime() {
		return createTime;
	}
	public void setCreateTime(int createTime) {
		this.createTime = createTime;
	}
	public long getInstallerTime() {
		return installerTime;
	}
	public void setInstallerTime(long installerTime) {
		this.installerTime = installerTime;
		installTime = Util.getInstallTime(installerTime);
	}
	public String getExplain() {
		return explain;
	}
	public void setExplain(String explain) {
		this.explain = explain;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public double getScore() {
		return score;
	}
	public void setScore(double score) {
		this.score = score;
	}
	public String getRegion() {
		return region;
	}
	public void setRegion(String region) {
		this.region = region;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public Order(String id, String publishUserId, String publishUserName,
			String publishUserPhone, int createTime, long installerTime,
			String explain, int status, double score, String region,
			String address,String shopOrderNumber) {
		super();
		this.id = id;
		this.publishUserId = publishUserId;
		this.publishUserName = publishUserName;
		this.publishUserPhone = publishUserPhone;
		this.createTime = createTime;
		this.installerTime = installerTime;
		this.explain = explain;
		this.status = status;
		this.score = score;
		this.region = region;
		this.address = address;
		this.shopOrderNumber = shopOrderNumber;
		//传入安装时间后,判断是否需要打分
		checkScore();
		installTime = Util.getInstallTime(installerTime);
	}
	
	private void checkScore(){
		long currentTime = System.currentTimeMillis();
//		int day = (int) (currentTime/1000/60/60/24);
//		int day1 = (int)(installerTime/1000/60/60/24);
		boolean need = false;
		if((currentTime-installerTime)>24*60*60*1000){
			need = true;
		}
		if(need&&currentTime>installerTime&&score==0&&status==1){
			needToScore = true;
		}else{
			needToScore = false;
		}
	}
	
	public String getInstallTime() {
		return installTime;
	}
	public void setInstallTime(String installTime) {
		this.installTime = installTime;
	}
	
}
